﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Cart.ascx.cs" Inherits="BSPortal.Usercontrol.Cart" %>
<br/>
<h4 class="campaign_navi_left_cate">Giỏ hàng của bạn:</h4><span id="lblAlert" runat="server">Hiện chưa có sản phẩm trong giỏ đặt hàng của bạn!</span>
<br/>
<div id="divContent" runat="server">
<div align="center">
<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <div style="width: 70%;">
            <asp:GridView ID="cartGrid" runat="server" AutoGenerateColumns="False" Width="100%"
                BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" 
                CellPadding="3" CellSpacing="2" 
                onrowcancelingedit="cartGrid_RowCancelingEdit" 
                onrowdeleting="cartGrid_RowDeleting" onrowediting="cartGrid_RowEditing" 
                onrowupdating="cartGrid_RowUpdating">
                <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
                <Columns>
                    <asp:BoundField DataField="Name" HeaderText="Tên sản phẩm" ReadOnly="True" />
                    <asp:ImageField DataImageUrlField="Image" ReadOnly="True"
                        DataImageUrlFormatString="~/images/{0}" HeaderText="Hình ảnh">
                        <ControlStyle Height="70px" />
                        <HeaderStyle Width="50px" />
                    </asp:ImageField>
                    <asp:BoundField DataField="Price" DataFormatString="{0:#,###}" 
                        HeaderText="Giá" ReadOnly="True" />
                    <asp:BoundField DataField="Discount" DataFormatString="{0:# %}" 
                        HeaderText="Giảm giá" ReadOnly="True" />
                    <asp:BoundField DataField="Amount" HeaderText="Số lượng" />
                    <asp:CommandField CancelText="Hủy" DeleteText="Xóa" EditText="Sửa" 
                        ShowEditButton="True" UpdateText="Lưu" />
                    <asp:ButtonField CommandName="Delete" Text="Xóa" />
                </Columns>
                <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
                <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            <span id="lblTotal" runat="server" style="float: right; padding: 10px 0 0;">Tổng cộng: <span style="color: #FF0000; font-weight: bold;" id="lblTotalPrice" runat="server"></span> vnđ</span>
            </div>
        <br/>
    </ContentTemplate>
</asp:UpdatePanel>
</div>
<div style="margin-top: 20px;" align="center">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <table style="width: 60%;" cellspacing="5px" cellpadding="3px">
        <tr>
            <td style="width:100px">
                Tên khách hàng</td>
            <td style="width:205px">
                <asp:TextBox ID="txtName"  Width="195px" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="txtName" ErrorMessage="(*)"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Điện thoại</td>
            <td>
                <asp:TextBox ID="txtPhone"  Width="195px" runat="server"></asp:TextBox>
            </td>
            <td><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="txtPhone" ErrorMessage="(*)"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td>
                Email</td>
            <td>
                <asp:TextBox ID="txtEmail"  Width="195px" runat="server"></asp:TextBox>                
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="txtEmail" ErrorMessage="(*)"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
                <td class="registry_row">
                    Tỉnh thành</td>
                <td align="left">
                    <asp:DropDownList ID="ddlCity" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="ddlCity_SelectedIndexChanged" Width="200px">
                    </asp:DropDownList>
                </td>
                <td/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ControlToValidate="ddlCity" ErrorMessage="(*)"></asp:RequiredFieldValidator>
            </tr>
        <tr>
                <td class="registry_row">
                    Quận/Huyện</td>
                <td align="left">                
                    <asp:DropDownList ID="ddlDistrict" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="ddlDistrict_SelectedIndexChanged" Width="200px">
                    </asp:DropDownList>
                </td>
                <td/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="ddlDistrict" ErrorMessage="(*)"></asp:RequiredFieldValidator>
            </tr>
        <tr>
                <td class="registry_row">
                    Phường/xã</td>
                <td align="left">
                    <asp:DropDownList ID="ddlWard" runat="server" Width="200px">
                    </asp:DropDownList>
                 </td>
                 <td/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                    ControlToValidate="ddlWard" ErrorMessage="(*)"></asp:RequiredFieldValidator>
            </tr>
        <tr>
            <td class="registry_row">
                Số nhà</td>
            <td align="left">
                <asp:TextBox ID="txtAddress"  Width="195px" runat="server"></asp:TextBox>
            </td>
            <td/>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                ControlToValidate="txtAddress" ErrorMessage="(*)"></asp:RequiredFieldValidator>
        </tr>
        <tr>
            <td>
                Ghi chú</td>
            <td>
                <asp:TextBox ID="txtNote" TextMode="MultiLine" Width="195px" Height="100px" 
                    runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                Hình thức giao hàng</td>
            <td>
                <input type="radio" name="tranformType" id="homeCheck" checked="true" runat="server"/><span>Giao hàng tận nhà. 
                <br />
                (Phí giao hàng: <asp:Label style="color: #FF0000;font-weight: bold" runat="server" ID="lblFee"></asp:Label> &nbsp;vnđ)</span>
                <br/>
                <br/>
                <input type="radio" name="tranformType" id="officeCheck" runat="server"/>Nhận hàng tại 72h.vn.
            </td>
            <td>
                
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                Thanh toán:</td>
            <td>
                <asp:DropDownList ID="ddlStatus" runat="server" Width="200px">
                                        <asp:ListItem Value="0">Trực tiếp</asp:ListItem>
                                        <asp:ListItem Value="1">Chuyển Khoản</asp:ListItem>
                                    </asp:DropDownList></td>
                                    <td>
                
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                
                &nbsp;</td>
        </tr>
    </table>
    </ContentTemplate>
</asp:UpdatePanel>
    <asp:Button ID="btnCheckout" runat="server" Text="Thanh toán" onclick="btnCheckout_Click" />
                    <input type="button" value="Tiếp tục mua" onclick="window.history.back()"/>
</div>
</div>
<script type="text/javascript" language="javascript">
    var txtName = document.getElementById('<%= txtName.ClientID %>');
    var txtPhone = document.getElementById('<%= txtPhone.ClientID %>');
    var txtEmail = document.getElementById('<%= txtEmail.ClientID %>');
    var txtAddress = document.getElementById('<%= txtAddress.ClientID %>');
    
    var erName = document.getElementById('erName');
    var erPhone = document.getElementById('erPhone');
    var erEmail = document.getElementById('erEmail');
    var erAddress = document.getElementById('erAddress');
    
    function CheckOrder()
    {
        erName.style.display = "none";
        erPhone.style.display = "none";
        erEmail.style.display = "none";
        erAddress.style.display = "none";
        if(txtName.value=='')
        {
            erName.style.display = "block";
            return false;
        }
        if(txtPhone.value=='')
        {
            erPhone.style.display = "block";
            return false;
        }
        if(txtEmail.value=='')
        {
            erEmail.style.display = "block";
            return false;
        }
            
        return true;
    }
</script>